'''
IO 多路复用方法 epoll
'''
from select import *
from socket import *

# 准备一些IO操作对象
udp = socket(type=SOCK_DGRAM)

tcp = socket()
tcp.bind(('0.0.0.0', 1210))
tcp.listen(5)
print(tcp.fileno())
# 查找字典
map = {}
# 创建ep对象
ep = epoll()
ep.register(udp, EPOLLOUT)
map[tcp.fileno()] = tcp
map[udp.fileno()] = udp
# 监控IO
print('开始监听')
events = ep.poll()
print('events:', events)
print(map)
